﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListOutStorageRecord.aspx.cs"
    Inherits="lcs.Web.Outstorage.ListOutStorageRecord" EnableEventValidation="false" %>
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../Scripts/JsTools.js" type="text/javascript"></script>
    <style type="text/css">
        td {
            font-size: 9pt;
        }

        a {
            color: Blue;
            text-decoration: none;
        }

        body {
            font-size: 9pt;
        }
    </style>
    <link href="../Style.css" rel="stylesheet" />
    <link href="../css/myStyle.css" rel="stylesheet" />
    <link href="/style.css" type="text/css" rel="stylesheet" />
    <link href="../../jquery-ui.min.css" rel="stylesheet" />
    <script src="../../js/jquery.js"></script>
    <script src="../../js/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#txt_projectname").autocomplete({
                minLength: 1, // 设置搜索的关键字最小长度// 设置自动完成列表的函数，函数包括两个参数，requset和response      
                source: function (request, response) {
                    $.ajax({
                        type: "POST",          // 通过request.term可以获得文本框内容   
                        url: "../../Handler.ashx?keyword=" + request.term,
                        contentType: "application/json; charset=gb2312",
                        dataType: "json",
                        success: function (data) {
                            // jQuery.map(array, callback) :将一个数组中的元素转换到另一个数组中。
                            //  下面就是把数组["value1", "value2",...]转换为[{value:"value1"}, {value:"value2"},...]                 
                            response($.map(data, function (item) {
                                return { label: item.projectName + item.proid, value: item.projectName };
                            }));
                        },
                        error: function () {
                            alert("ajax请求失败");
                        }
                    });
                }
            });
        });

        function showQRC(id) {

            window.open('../PrintQCR.aspx?id=' + id + "&type=out", 'newwindow', 'height=600, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div style="text-align: left; margin-bottom: 10px; margin-top: 10px;">
                <b>出库记录 </b>
            </div>
            <div style="text-align: left; margin-bottom: 10px; margin-top: 10px;">
                项目编号：
            <asp:TextBox ID="txt_proid" runat="server"></asp:TextBox>&nbsp; 项目名称：<asp:TextBox
                ID="txt_projectname" runat="server"></asp:TextBox>&nbsp; 物料名称：<asp:TextBox ID="txt_material"
                    runat="server"></asp:TextBox>
                &nbsp;
            </div>

            <div>
                到货地点：
            <asp:TextBox ID="txt_receive_address" runat="server"></asp:TextBox>&nbsp; 目的项目：<asp:TextBox
                ID="txt_targetProjectName" runat="server"></asp:TextBox>&nbsp; 
            出库时间：<asp:TextBox ID="txt_startTime" runat="server" Width="82px" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})"></asp:TextBox>
                -<asp:TextBox ID="txt_endTime" runat="server" Width="82px" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})"></asp:TextBox>
            </div>
            <div style="text-align: left; margin-bottom: 10px; margin-top: 10px;">
                仓&nbsp;&nbsp;库： <asp:DropDownList ID="ddlstore" runat="server">
                </asp:DropDownList>&nbsp;&nbsp;<asp:Button ID="btn_sel" runat="server" Text="查询" OnClick="btn_sel_Click" CssClass="btn" />

            </div>
            <div>
                <%--当前共有<asp:Label ID="lbl_count" runat="server" Text=""></asp:Label>条记录--%>
            </div>
            <div style="text-align: center">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateCopxlumns="False"
                    OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="20" BorderWidth="0px" CellPadding="0" CellSpacing="1" CssClass="gv" GridLines="None"
                    Width="2200px" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
                    <Columns>
                        <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <a href="javascript:showQRC(<%# Eval("out_storage_id") %>)" style="color: Blue">生成二维码 </a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="spname" HeaderText="仓位名称" />
                        <asp:BoundField DataField="spadd" HeaderText="仓位地址" />
                        <asp:BoundField DataField="sname" HeaderText="仓库名称" />
                        <asp:BoundField DataField="material" HeaderText="物料描述" />
                        <asp:TemplateField HeaderText="出库数量">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("out_storage_count") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lbl_count" runat="server" Text='<%# Bind("out_storage_count") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="单价">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("unitprice") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lbl_unit" runat="server" Text='<%# Bind("unitprice", "{0:N2}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="小计">
                            <ItemTemplate>
                                <asp:Label ID="lbl_xiaoji" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="unit" HeaderText="数量单位" />
                        <asp:BoundField DataField="supplier" HeaderText="供应商" />
                        <asp:BoundField DataField="usework" HeaderText="需用单位" />
                        <asp:BoundField DataField="projectname" HeaderText="项目名称" />
                        <asp:BoundField DataField="proid" HeaderText="项目编号" />
                        <asp:BoundField DataField="out_storage_Time" HeaderText="出库时间" />
                        <asp:BoundField DataField="user_name" HeaderText="出库人员" />
                        <asp:BoundField DataField="receive_userName" HeaderText="接收人" />
                        <asp:BoundField DataField="receive_address" HeaderText="到货地点" />
                        <asp:BoundField DataField="targetProjectName" HeaderText="目的项目" />
                    </Columns>
                    <PagerStyle CssClass="mypager" />
                </asp:GridView>
            </div>
            <div>
                  <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="True" CurrentPageButtonPosition="Center"
                            PageSize="20" AlwaysShowFirstLastPageNumber="True" CustomInfoTextAlign="Left"
                    FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" NumericButtonCount="10"
                    PrevPageText="上一页" CssClass="paginator" CurrentPageButtonClass="" CustomInfoHTML="第 %CurrentPageIndex% 页|共 %PageCount% 页,%RecordCount%条记录 "
                    LayoutType="Table" ShowCustomInfoSection="Left" ShowNavigationToolTip="True"
                    ShowPageIndexBox="Always" PageIndexBoxType="DropDownList" TextAfterPageIndexBox="页"
                    TextBeforePageIndexBox="转到第" onpagechanged="AspNetPager1_PageChanged">
                </webdiyer:AspNetPager>
            </div>
            <div style="margin-top: 5px; margin-bottom: 5px;">
                共有<asp:Label ID="lbl_count" runat="server"></asp:Label>条记录，本页单价总计：
         
            <asp:Label ID="lbl_price" runat="server"></asp:Label>
                &nbsp;元，单价总计：<asp:Label ID="lbl_priceall" runat="server"></asp:Label>
                &nbsp;元</div>
            <div>
                <asp:Button ID="btn_out" runat="server" Text="导出" OnClick="btn_out_Click" CssClass="btn" />
            </div>
        </div>
    </form>
</body>
</html>
